package com.ysjweb.dish.Service.impl;

import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.spring.AiService;
import dev.langchain4j.service.spring.AiServiceWiringMode;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import reactor.core.publisher.Flux;

@AiService(
        wiringMode = AiServiceWiringMode.EXPLICIT,
        chatModel="openAiChatModel",
        streamingChatModel = "openAiStreamingChatModel"
)
public interface AiConsult {

    @SystemMessage(fromResource = "role.txt")
    public Flux<String> consult(String message);

    @Retryable(
            maxAttempts = 3,
            backoff = @Backoff(delay = 1000,multiplier = 2),
            exclude = {
                    InterruptedException.class,
            }
    )
    @SystemMessage("当要求推荐食物时只需要推荐食品名称,且只需要返回一种菜名,如果有多个合适的菜品则只需要随机返回一种菜品名称")
    public String RecommendDish(String condition);
}
